package com.jtpay.sth0409.patternlockdemo;


import android.content.Intent;
import android.text.TextUtils;

import com.jtpay.sth0409.patternlockdemo.Util.AppUtil;
import com.jtpay.sth0409.patternlockdemo.Util.ContentUtil;
import com.jtpay.sth0409.patternlockdemo.Util.SPUtils;

import java.util.List;

import me.zhanghai.android.patternlock.ConfirmPatternActivity;
import me.zhanghai.android.patternlock.PatternUtils;
import me.zhanghai.android.patternlock.PatternView;

/**
 * Created by XiaoMieMie on 2017/03/28-11:55.
 */

/**
 * 密码绘制解锁界面
 */
public class SampleConfirmPatternActivity extends ConfirmPatternActivity {




    @Override
    protected void onCancel() {
        this.finish();
        AppUtil.getInstance(this).finishAllAC();
    }

    @Override
    protected boolean isStealthModeEnabled() {
        // TODO: Return the value from SharedPreferences.
        return false;
    }

    @Override
    protected boolean isPatternCorrect(List<PatternView.Cell> pattern) {
        // TODO: Get saved pattern sha1.
        String patternSha1 = SPUtils.getInstance(this).getPattern(ContentUtil.KEY);
        return TextUtils.equals(PatternUtils.patternToSha1String(pattern), patternSha1);
    }

    @Override
    protected void onForgotPassword() {
        AppUtil.getInstance(this).pushAC(this);
        startActivity(new Intent(this, ResetActivity.class));
    }
}
